//
//  VippViewController.m
//  家范
//
//  Created by 吴军虎吴军虎 on 16/4/15.
//  Copyright © 2016年 lanjue. All rights reserved.
//

#import "VippViewController.h"
#import "SupeiViewController.h"
#import "PulsingHaloLayer.h"

@interface VippViewController ()<UIScrollViewDelegate>
{
    UIBezierPath *_path;
}


@property(nonatomic,retain)UIScrollView * myScrollView;
@property (nonatomic,retain)  UIImageView *touxiangButton;
@property (nonatomic,retain) UIView *wightView;
@property (nonatomic,retain) UIView *weghtView;
@property (nonatomic,retain) UIView *myFootView;
@property (nonatomic,retain) UILabel *aLabel;
@property (nonatomic,retain) UILabel *bLabel;
@property (nonatomic,retain) UILabel *valueLabel;
@property (nonatomic,retain) UILabel *YHlabel;
@property (nonatomic,retain) UILabel *GSlabel;
@property (nonatomic,retain) UILabel *DDlabe;
@property (nonatomic,retain) UIImageView *activeImageView;
@property (nonatomic, strong)CAShapeLayer *arcLayer;
@property (nonatomic, strong) PulsingHaloLayer *halo;


@end

@implementation VippViewController

-(void) viewWillAppear:(BOOL)animated{
    
    self.navigationController.navigationBarHidden=NO;
     self.navigationController.navigationBar.barStyle=UIBarStyleBlackTranslucent;
    self.tabBarController.tabBar.hidden=YES;
}

- (void)viewWillDisappear:(BOOL)animated {
    
    self.navigationController.navigationBarHidden = NO;
    self.tabBarController.tabBar.hidden=NO;
}



- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back"] style:UIBarButtonItemStylePlain target:self action:@selector(Back:)];
    self.navigationItem.leftBarButtonItem.tintColor = [UIColor whiteColor];
    
    self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"wen"] style:UIBarButtonItemStylePlain target:self action:@selector(souSuo:)];
    self.navigationItem.rightBarButtonItem.tintColor = [UIColor whiteColor];
    
    //顶部
    [self createHeader];
    
    //头像
    [self createZhong];
    
    //签到
    [self createFoot];
    
    //排名
    [self createMing];
    
    //活跃度
    [self createHuo];
}

#pragma mark 顶部
-(void) createHeader
{
    //滑动条
    _myScrollView=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    _myScrollView.bounces=YES;
    _myScrollView.delegate=self;
    self.automaticallyAdjustsScrollViewInsets=YES;
    _myScrollView.showsHorizontalScrollIndicator=NO;
    _myScrollView.showsVerticalScrollIndicator=NO;
    _myScrollView.backgroundColor=HEADVC;
    _myScrollView.contentSize=CGSizeMake(self.view.frame.size.width, self.view.frame.size.height+200*AUTO_HEIGHT);
    [self.view addSubview: _myScrollView];
    
    
    
}

#pragma mark 头像
-(void) createZhong
{
    //头像的图片
    _touxiangButton= [[UIImageView alloc]init];
    _touxiangButton.layer.masksToBounds = YES;
    _touxiangButton.layer.cornerRadius = 62/2;
    _touxiangButton.image=[UIImage imageNamed:@"headBackImage"];
    [_myScrollView addSubview:_touxiangButton];
    
    [_touxiangButton mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.mas_equalTo(_myScrollView);
        make.top.equalTo(_myScrollView).offset(80 *AUTO_HEIGHT);
        make.size.mas_equalTo(CGSizeMake(62.00*AUTO_WIDTH, 62.00*AUTO_HEIGHT));
        
    }];
    
    
    //在_touxiangButton周围加圆
    for (int i=0; i<4; i++) {
        
        _path=[UIBezierPath bezierPath];
        [_path addArcWithCenter:CGPointMake(_myScrollView.center.x, 80*AUTO_HEIGHT+31) radius:31+i*8 startAngle:0 endAngle:2* M_PI clockwise:YES];
        
        CAShapeLayer *arcLayer=[CAShapeLayer layer];
        arcLayer.path=_path.CGPath;
        arcLayer.fillColor=[[UIColor clearColor]CGColor];
        arcLayer.strokeColor=[[UIColor grayColor]CGColor];
        arcLayer.lineWidth=0.5f;
        arcLayer.frame=CGRectMake(0, 0, 62.0/2*AUTO_WIDTH+16*i, 62.0/2*AUTO_HEIGHT+16*i);
        [_myScrollView.layer addSublayer:arcLayer];
        
    }
    
    //动画圈圈
    __weak __typeof(self)  weakSelf=self;
    
    self.timeBlock=^(NSString *timeStr){
        [weakSelf.arcLayer removeFromSuperlayer];
        
        CGFloat num=[timeStr floatValue];
        CGFloat scale=num/420;
        CGFloat endAngle;
        if (scale >1) {
            scale =1;
            endAngle =3.5 *M_PI;
        }else{
            
            endAngle=M_PI *scale +2 *M_PI;
        }
        
        UIBezierPath *path=[UIBezierPath bezierPath];
        [path addArcWithCenter:CGPointMake(weakSelf.myScrollView.center.x, weakSelf.touxiangButton.center.y) radius:31
                    startAngle:M_PI *1.5 endAngle:endAngle clockwise:YES];
        
        weakSelf.arcLayer=[CAShapeLayer layer];
        weakSelf.arcLayer.path=path.CGPath;
        weakSelf.arcLayer.fillColor=[[UIColor clearColor]CGColor];
        weakSelf.arcLayer.strokeColor=[[UIColor redColor]CGColor];
        weakSelf.arcLayer.lineWidth=2.0f;
        weakSelf.arcLayer.frame=weakSelf.myScrollView.frame;
        [weakSelf.myScrollView.layer addSublayer:weakSelf.arcLayer];
        [weakSelf  drawLineAnimation:weakSelf.arcLayer andTimeNum:num];
        
        
        //添加波浪动画
        weakSelf.halo=[PulsingHaloLayer layer];
        weakSelf.halo.animationDuration=num * 0.01 *2;
        weakSelf.halo.position=CGPointMake(weakSelf.myScrollView.center.x, 80*AUTO_HEIGHT+31);
        [weakSelf.myScrollView.layer insertSublayer:weakSelf.halo below:weakSelf.touxiangButton.layer];
    };
    
    UIBezierPath *whitePath=[UIBezierPath bezierPath];
    [whitePath addArcWithCenter:CGPointMake(_myScrollView.center.x, 80*AUTO_HEIGHT+31) radius:31 +8 startAngle:M_PI/2 *3 endAngle:M_PI/2 clockwise:YES];
    CAShapeLayer *whiteArcLayer=[CAShapeLayer layer];
    whiteArcLayer.path=whitePath.CGPath;
    whiteArcLayer.fillColor=[[UIColor clearColor]CGColor];
    whiteArcLayer.strokeColor=[[UIColor whiteColor]CGColor];
    whiteArcLayer.lineWidth=3.0f;
    whiteArcLayer.frame=self.view.frame;
    [_myScrollView.layer addSublayer:whiteArcLayer];
    
    
    
    //左侧黄色底图
    UIView *aView = [[UIView alloc]init];
    aView.backgroundColor = HEADVC;
    [_myScrollView addSubview:aView];
    [aView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(_myScrollView).offset(80.00*AUTO_HEIGHT);
        make.left.equalTo(self.view).offset(10.00*AUTO_WIDTH);
        make.right.equalTo(_touxiangButton.mas_left).offset(-10.00*AUTO_WIDTH-32);
        make.height.mas_equalTo(70.00 *AUTO_HEIGHT);
        
    }];
    
    //111
    _aLabel= [[UILabel alloc]init];
    _aLabel.textAlignment = NSTextAlignmentCenter;
    _aLabel.textColor=[UIColor whiteColor];
    _aLabel.text=@"111";
    _aLabel.font=[UIFont fontWithName:SHUZI size:23.00 *AUTO_HEIGHT];
    [_myScrollView addSubview:_aLabel];
    [_aLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(aView).offset(20.00*AUTO_HEIGHT);
        make.left.equalTo(aView).offset(6.00*AUTO_WIDTH);
        make.right.equalTo(aView.mas_right).offset(-10.00*AUTO_WIDTH);
        
    }];
    
    //近7天活跃度
    UILabel *aLabel2 = [[UILabel alloc]init];
    aLabel2.textAlignment = NSTextAlignmentCenter;
    aLabel2.text=@"近7天活跃度";
    aLabel2.textColor=[UIColor whiteColor];
    aLabel2.font=[UIFont fontWithName:ZIXING size:13.00*AUTO_WIDTH];
    [_myScrollView addSubview:aLabel2];
    [aLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(_aLabel.mas_bottom).offset(10.00*AUTO_HEIGHT);
        make.left.equalTo(aView).offset(0.00*AUTO_WIDTH);
        make.right.equalTo(aView.mas_right).offset(0.00*AUTO_WIDTH);
        
    }];
    
    
    //右侧黄色底图
    UIView *bView = [[UIView alloc]init];
    bView.backgroundColor = HEADVC;
    [_myScrollView addSubview:bView];
    [bView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(_myScrollView).offset(80.00*AUTO_HEIGHT);
        make.left.equalTo(_touxiangButton.mas_right).offset(10.00*AUTO_WIDTH+32);
        make.right.equalTo(self.view.mas_right).offset(-10.00*AUTO_WIDTH);
        make.height.mas_equalTo(80.00 *AUTO_HEIGHT);
        
    }];
    
    //999
    _bLabel= [[UILabel alloc]init];
    _bLabel.textAlignment = NSTextAlignmentCenter;
    _bLabel.text=@"999+";
    _bLabel.textColor=[UIColor whiteColor];
    _bLabel.font=[UIFont fontWithName:SHUZI size:23.00 *AUTO_HEIGHT];
    [_myScrollView addSubview:_bLabel];
    [_bLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(bView).offset(20.00*AUTO_HEIGHT);
        make.left.equalTo(bView).offset(10.00*AUTO_WIDTH);
        make.right.equalTo(bView.mas_right).offset(-10.00*AUTO_WIDTH);
        
    }];
    
    //我的排名
    UILabel *bLabel2 = [[UILabel alloc]init];
    bLabel2.textAlignment = NSTextAlignmentCenter;
    bLabel2.text=@"我的排名";
    bLabel2.textColor=[UIColor whiteColor];
    bLabel2.font=[UIFont fontWithName:ZIXING size:13.00*AUTO_WIDTH];
    [_myScrollView  addSubview:bLabel2];
    [bLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(_bLabel.mas_bottom).offset(10.00*AUTO_HEIGHT);
        make.left.equalTo(bView).offset(0.00*AUTO_WIDTH);
        make.right.equalTo(bView.mas_right).offset(0.00*AUTO_WIDTH);
        
    }];
    
    
}

#pragma mark 签到
-(void) createFoot
{
    
    //绿色框
    _myFootView = [[UIView alloc]init];
    _myFootView.backgroundColor = GH;
    _myFootView.userInteractionEnabled = YES;
    [_myScrollView addSubview:_myFootView];
    [_myFootView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(_touxiangButton.mas_bottom).offset(90/2 *AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(self.view.frame.size.width, self.view.frame.size.height+300 *AUTO_HEIGHT));
    }];
    
    
    //白色底图
    _wightView=[[UIView alloc]init];
    _wightView.backgroundColor=[UIColor whiteColor];
    _wightView.layer.cornerRadius=10 *AUTO_WIDTH;
    [_myScrollView addSubview:_wightView];
    [_wightView mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(_myFootView.mas_top).offset(30/2 *AUTO_HEIGHT);
        make.left.equalTo(self.view).offset(12/2 *AUTO_WIDTH);
        make.right.equalTo(self.view).offset(-12/2 *AUTO_WIDTH);
        make.height.mas_equalTo(230/2 *AUTO_HEIGHT);
    }];
    
    
    
    //每日签到
    UILabel *rilabel=[[UILabel alloc]init];
    rilabel.textAlignment=NSTextAlignmentCenter;
    [self setUpOneChildViewController:rilabel backgroundColor:nil alpha:0.6 text:@"每日签到" textColor:[UIColor blackColor] font:[UIFont fontWithName:ZIXING size:15.00 *AUTO_WIDTH]];
    [rilabel mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(_wightView).offset(30/2 *AUTO_HEIGHT);
        make.left.equalTo(_wightView).offset(23 *AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(100 *AUTO_WIDTH, 30 *AUTO_HEIGHT));
    }];
    
    
    //活跃度
    UILabel *label2=[[UILabel alloc]init];
    label2.textAlignment=NSTextAlignmentCenter;
    [self setUpOneChildViewController:label2 backgroundColor:nil alpha:0.4 text:@"10活跃度/次" textColor:HS font:[UIFont systemFontOfSize:13*AUTO_WIDTH]];
    
    [label2 mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(rilabel.mas_bottom).offset(0);
        make.left.equalTo(_wightView).offset(5 *AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(140 *AUTO_WIDTH, 25 *AUTO_HEIGHT));
    }];
    
    
    //签到黄色底图
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.layer.masksToBounds = YES;
    button.layer.cornerRadius = 5.00*AUTO_WIDTH;
    button.backgroundColor = GH;
    [button setTitle:@"签到" forState:UIControlStateNormal];
    [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    button.titleLabel.font=[UIFont fontWithName:ZIXING size:15.00*AUTO_WIDTH];
    [button addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];
    [_wightView addSubview:button];
    [button mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(label2.mas_bottom).offset(5 *AUTO_HEIGHT);
        make.left.equalTo(_wightView).offset(50.00*AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(45 *AUTO_WIDTH, 25 *AUTO_HEIGHT));
        
    }];
    
    
    
    //每日速配
    UILabel *sulabel=[[UILabel alloc]init];
    sulabel.textAlignment=NSTextAlignmentCenter;
    [self setUpOneChildViewController:sulabel backgroundColor:nil alpha:0.6 text:@"每日速配" textColor:[UIColor blackColor] font:[UIFont fontWithName:ZIXING size:15.00 *AUTO_WIDTH]];
    [sulabel mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(_wightView).offset(30/2 *AUTO_HEIGHT);
        make.right.equalTo(_wightView).offset(-23 *AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(100 *AUTO_WIDTH, 30 *AUTO_HEIGHT));
    }];
    
    
    //活跃度
    UILabel *huolabel=[[UILabel alloc]init];
    huolabel.textAlignment=NSTextAlignmentCenter;
    [self setUpOneChildViewController:huolabel backgroundColor:nil alpha:0.4 text:@"10活跃度/次" textColor:HS font:[UIFont systemFontOfSize:13*AUTO_HEIGHT]];
    [huolabel mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(rilabel.mas_bottom).offset(0);
        make.right.equalTo(_wightView).offset(-5 *AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(140 *AUTO_WIDTH, 25 *AUTO_HEIGHT));
    }];
    
    
    //签到黄色底图
    UIButton *button1 = [UIButton buttonWithType:UIButtonTypeCustom];
    button1.layer.masksToBounds = YES;
    button1.layer.cornerRadius = 5.00*AUTO_WIDTH;
    button1.backgroundColor = GH;
    [button1 setTitle:@"前往" forState:UIControlStateNormal];
    [button1 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [button1 addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
    button1.titleLabel.font=[UIFont fontWithName:ZIXING size:14.00*AUTO_WIDTH];
    [_wightView addSubview:button1];
    [button1 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(huolabel.mas_bottom).offset(5*AUTO_HEIGHT);
        make.right.equalTo(_wightView).offset(-50.00*AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(45 *AUTO_WIDTH, 25 *AUTO_HEIGHT));
        
    }];
    
    
    //白色底图
    _weghtView=[[UIView alloc]init];
    _weghtView.backgroundColor=[UIColor whiteColor];
    _weghtView.layer.cornerRadius=10 *AUTO_WIDTH;
    [_myScrollView addSubview:_weghtView];
    [_weghtView mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(_wightView.mas_bottom).offset(20/2 *AUTO_HEIGHT);
        make.left.equalTo(self.view).offset(12/2 *AUTO_WIDTH);
        make.right.equalTo(self.view).offset(-12/2 *AUTO_WIDTH);
        make.height.mas_equalTo(230/2 *AUTO_HEIGHT);
    }];
    
    
    //聊聊新任务
    UILabel *renlabel=[[UILabel alloc]init];
    renlabel.textAlignment=NSTextAlignmentCenter;
    [self setUpOneChildViewController:renlabel backgroundColor:nil alpha:0.6 text:@"聊聊新任务" textColor:[UIColor blackColor] font:[UIFont fontWithName:ZIXING size:15.00 *AUTO_WIDTH]];
    [renlabel mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(_weghtView.mas_top).offset(30/2 *AUTO_HEIGHT);
        make.left.equalTo(_weghtView).offset(23 *AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(100 *AUTO_WIDTH, 30 *AUTO_HEIGHT));
    }];
    
    
    //活跃度
    UILabel *huolabel2=[[UILabel alloc]init];
    huolabel2.textAlignment=NSTextAlignmentCenter;
    [self setUpOneChildViewController:huolabel2 backgroundColor:nil alpha:0.4 text:@"10活跃度/次" textColor:HS font:[UIFont systemFontOfSize:13*AUTO_WIDTH]];
    [huolabel2 mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(renlabel.mas_bottom).offset(0);
        make.left.equalTo(_weghtView).offset(5 *AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(140 *AUTO_WIDTH, 25 *AUTO_HEIGHT));
    }];
    
    
    //签到黄色底图
    UIButton *button3 = [UIButton buttonWithType:UIButtonTypeCustom];
    button3.layer.masksToBounds = YES;
    button3.layer.cornerRadius = 5.00*AUTO_WIDTH;
    button3.backgroundColor = GH;
    [button3 setTitle:@"前往" forState:UIControlStateNormal];
    [button3 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    button3.titleLabel.font=[UIFont fontWithName:ZIXING size:15.00*AUTO_WIDTH];
    [button3 addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
    [_weghtView addSubview:button3];
    [button3 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(huolabel2.mas_bottom).offset(5*AUTO_HEIGHT);
        make.left.equalTo(_weghtView).offset(50.00*AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(45 *AUTO_WIDTH, 25 *AUTO_HEIGHT));
        
    }];
    
    
    //分享主页
    UILabel *fenlabel=[[UILabel alloc]init];
    fenlabel.textAlignment=NSTextAlignmentCenter;
    [self setUpOneChildViewController:fenlabel backgroundColor:nil alpha:0.6 text:@"分享主页" textColor:[UIColor blackColor] font:[UIFont fontWithName:ZIXING size:15.00 *AUTO_WIDTH]];
    [fenlabel mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(_weghtView.mas_top).offset(30/2 *AUTO_HEIGHT);
        make.right.equalTo(_weghtView).offset(-23 *AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(100 *AUTO_WIDTH, 30 *AUTO_HEIGHT));
    }];
    
    
    //活跃度
    UILabel *huolabel1=[[UILabel alloc]init];
    huolabel1.textAlignment=NSTextAlignmentCenter;
    [self setUpOneChildViewController:huolabel1 backgroundColor:nil alpha:0.4 text:@"10活跃度/次" textColor:HS font:[UIFont systemFontOfSize:13*AUTO_HEIGHT]];
    
    [huolabel1 mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(fenlabel.mas_bottom).offset(0);
        make.right.equalTo(_weghtView).offset(-5 *AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(140 *AUTO_WIDTH, 25 *AUTO_HEIGHT));
    }];
    
    
    //签到黄色底图
    UIButton *button5 = [UIButton buttonWithType:UIButtonTypeCustom];
    button5.layer.masksToBounds = YES;
    button5.layer.cornerRadius = 5.00*AUTO_WIDTH;
    button5.backgroundColor = GH;
    [button5 setTitle:@"分享" forState:UIControlStateNormal];
    [button5 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [button5 addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
    button5.titleLabel.font=[UIFont fontWithName:ZIXING size:15.00*AUTO_HEIGHT];
    [_weghtView addSubview:button5];
    [button5 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(huolabel1.mas_bottom).offset(5*AUTO_HEIGHT);
        make.right.equalTo(_weghtView).offset(-50.00*AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(45 *AUTO_WIDTH, 25 *AUTO_HEIGHT));
        
    }];
    
}

#pragma mark 排名
-(void) createMing
{
    
    //排名
    UIView *activeView = [[UIView alloc]init];
    activeView.backgroundColor = GH;
    [self.myScrollView addSubview:activeView];
    [activeView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(_weghtView.mas_bottom).offset(30/2*AUTO_HEIGHT);
        make.left.equalTo(self.view).offset(30.00*AUTO_WIDTH);
        make.right.equalTo(self.view.mas_right).offset(-20.00*AUTO_WIDTH);
        make.height.mas_equalTo(40.00 *AUTO_HEIGHT);
        
    }];
    
    
    //活跃度排名越高
    UILabel *cLabel = [[UILabel alloc]init];
    [self setUpOneChildViewController:cLabel backgroundColor:nil alpha:1 text: @"活跃度排名越高" textColor:[UIColor whiteColor] font:[UIFont fontWithName:ZIXING size:13.00*AUTO_WIDTH]];
    cLabel.textAlignment=NSTextAlignmentCenter;
    [cLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(activeView).offset(-5.00*AUTO_HEIGHT);
        make.left.equalTo(activeView).offset(50.00*AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(cLabel.text.length*13.00*AUTO_WIDTH, 22.00*AUTO_HEIGHT));
    }];
    
    
    //个人曝光率越高
    UILabel *cLabel2 = [[UILabel alloc]init];
    [self setUpOneChildViewController:cLabel2 backgroundColor:GH alpha:1 text:@"个人曝光率越高" textColor:[UIColor whiteColor] font:[UIFont fontWithName:ZIXING size:13.00*AUTO_WIDTH]];
    cLabel2.textAlignment=NSTextAlignmentLeft;
    [cLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(activeView).offset(-5.00*AUTO_HEIGHT);
        make.left.equalTo(cLabel.mas_right).offset(38.00*AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(cLabel2.text.length*15.00*AUTO_WIDTH, 22.00*AUTO_HEIGHT));
    }];
    
    
    //排名图片
    _activeImageView= [[UIImageView alloc]init];
    _activeImageView.image = [UIImage imageNamed:@"pang"];
    [activeView addSubview:_activeImageView];
    [_activeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(activeView).offset(-2 *AUTO_HEIGHT);
        make.left.equalTo(cLabel.mas_right).offset(7.00*AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(24.00*AUTO_WIDTH, 15.00*AUTO_HEIGHT));
        
    }];
    
}

#pragma mark 活跃度
-(void) createHuo
{
    
    //底部白色底图
    UIView *wightVew = [[UIView alloc]init];
    wightVew.backgroundColor = [UIColor whiteColor];
    wightVew.layer.cornerRadius=10.00 *AUTO_HEIGHT;
    [_myScrollView addSubview:wightVew];
    [wightVew mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(_activeImageView.mas_bottom).offset(20/2 *AUTO_HEIGHT);
        make.left.equalTo(self.view).offset(12/2 *AUTO_WIDTH);
        make.right.equalTo(self.view).offset(-12/2 *AUTO_WIDTH);
        make.height.mas_equalTo(470/2 *AUTO_HEIGHT);
        
        
    }];
    
    //头像
    UIImageView *nameImageView = [[UIImageView alloc]init];
    nameImageView.backgroundColor =GH;
    nameImageView.layer.masksToBounds = YES;
    nameImageView.layer.cornerRadius = 20.00*AUTO_HEIGHT;
    nameImageView.image = [UIImage imageNamed:@"headBackImage"];
    [wightVew addSubview:nameImageView];
    [nameImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(wightVew.mas_top).offset(24.00*AUTO_HEIGHT);
        make.left.equalTo(wightVew).offset(17.00*AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(40.00*AUTO_WIDTH, 40.00*AUTO_HEIGHT));
        
    }];
    
    
    //1
    UILabel *detailLabel = [[UILabel alloc]init];
    detailLabel.textAlignment = NSTextAlignmentCenter;
    detailLabel.layer.masksToBounds = YES;
    detailLabel.layer.cornerRadius = 15.00*AUTO_WIDTH/2;
    [self setUpOneChildViewController:detailLabel backgroundColor:GH alpha:1.0 text:[NSString stringWithFormat:@"%d",1] textColor:[UIColor whiteColor] font:nil];
    [detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(wightVew).offset(26.00*AUTO_HEIGHT);
        make.left.equalTo(nameImageView.mas_right).offset(15.00*AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(15.00*AUTO_WIDTH, 15.00*AUTO_HEIGHT));
        
    }];
    
    
    //活跃度
    UILabel *activeLabel = [[UILabel alloc]init];
    [self setUpOneChildViewController:activeLabel backgroundColor:nil alpha:0.8 text:@"活跃度" textColor:HS font:[UIFont fontWithName:ZIXING size:13.00*AUTO_WIDTH]];
    [activeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(wightVew).offset(21.00*AUTO_HEIGHT);
        make.left.equalTo(detailLabel.mas_right).offset(5.00*AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(activeLabel.text.length*14.00*AUTO_WIDTH, 26.00*AUTO_HEIGHT));
        
    }];
    
    //100
    _valueLabel= [[UILabel alloc]init];
    [self setUpOneChildViewController:_valueLabel backgroundColor:[UIColor whiteColor] alpha:1.0 text:@"100" textColor:GH font: [UIFont systemFontOfSize:16 *AUTO_WIDTH]];
    
    [_valueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(wightVew).offset(20.00*AUTO_HEIGHT);
        make.left.equalTo(activeLabel.mas_right).offset(5.00*AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(36.00*AUTO_WIDTH, 26.00*AUTO_WIDTH));
        
    }];
    
    
    //赵信
    _YHlabel= [[UILabel alloc]init];
    [self setUpOneChildViewController:_YHlabel backgroundColor:nil alpha:0.6 text:@"赵信" textColor:nil font:[UIFont systemFontOfSize:13.00*AUTO_WIDTH]];
    _YHlabel.textAlignment=NSTextAlignmentLeft;
    [_YHlabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(detailLabel.mas_bottom).offset(20.00*AUTO_HEIGHT/2);
        make.left.equalTo(nameImageView.mas_right).offset(36.00*AUTO_WIDTH/2);
        make.size.mas_equalTo(CGSizeMake(_YHlabel.text.length*16.00*AUTO_WIDTH, 15.00*AUTO_HEIGHT));
        
    }];
    
    
    //竖线
    UILabel *line1 = [[UILabel alloc]init];
    [self setUpOneChildViewController:line1 backgroundColor:HS alpha:0.6 text:nil textColor:nil font:nil];
    [line1 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(detailLabel.mas_bottom).offset(20.00*AUTO_HEIGHT/2);
        make.left.equalTo(_YHlabel.mas_right).offset(2.00*AUTO_WIDTH/2);
        make.size.mas_equalTo(CGSizeMake(1,15.00*AUTO_HEIGHT));
        
    }];
    
    
    //设计师
    _GSlabel= [[UILabel alloc]init];
    [self setUpOneChildViewController:_GSlabel backgroundColor:nil alpha:0.6 text:@"设计师" textColor:nil font:[UIFont systemFontOfSize:13.00*AUTO_WIDTH]];
    _GSlabel.textAlignment=NSTextAlignmentCenter;
    [_GSlabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(detailLabel.mas_bottom).offset(20.00*AUTO_HEIGHT/2);
        make.left.equalTo(line1.mas_right).offset(2.00*AUTO_WIDTH/2);
        make.size.mas_equalTo(CGSizeMake(_GSlabel.text.length*15.00*AUTO_WIDTH, 15.00*AUTO_HEIGHT));
        
    }];
    
    
    //竖线
    UILabel *line2 = [[UILabel alloc]init];
    [self setUpOneChildViewController:line2 backgroundColor:HS alpha:0.8 text:nil textColor:nil font:nil];
    [line2 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(detailLabel.mas_bottom).offset(20.00*AUTO_HEIGHT/2);
        make.left.equalTo(_GSlabel.mas_right).offset(2.00*AUTO_WIDTH/2);
        make.size.mas_equalTo(CGSizeMake(1,15.00*AUTO_HEIGHT));
        
    }];
    
    
    //杭州
    _DDlabe= [[UILabel alloc]init];
    [self setUpOneChildViewController:_DDlabe backgroundColor:nil alpha:0.6 text:@"杭州" textColor:nil font:[UIFont systemFontOfSize:13.00*AUTO_WIDTH]];
    _DDlabe.textAlignment=NSTextAlignmentCenter;
    [_DDlabe mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(detailLabel.mas_bottom).offset(20.00*AUTO_HEIGHT/2);
        make.left.equalTo(line2.mas_right).offset(4.00*AUTO_WIDTH/2);
        make.size.mas_equalTo(CGSizeMake(_DDlabe.text.length*18.00*AUTO_WIDTH, 15.00*AUTO_HEIGHT));
    }];
    
    
    //画线
    UILabel *onelabel=[[UILabel alloc]init];
    [self setUpOneChildViewController:onelabel backgroundColor:KH alpha:0.5 text:nil textColor:nil font:nil];
    [onelabel mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(wightVew.mas_top).offset(80.00 *AUTO_HEIGHT);
        make.left.equalTo(wightVew.mas_left).offset(0);
        make.size.mas_equalTo(CGSizeMake(self.view.frame.size.width-12.00 *AUTO_WIDTH, 1.00 *AUTO_HEIGHT));
    }];
    
}

-(void)drawLineAnimation:(CALayer*)layer andTimeNum:(float)time;
{
    CABasicAnimation *bas=[CABasicAnimation animationWithKeyPath:@"strokeEnd"];
    bas.duration= 0.01 * time;
    bas.delegate=self;
    bas.fromValue=[NSNumber numberWithInteger:0];
    bas.toValue=[NSNumber numberWithInteger:1.5];
    [layer addAnimation:bas forKey:@"key"];
}
#pragma  mark UILabel
-(void) setUpOneChildViewController:(UILabel *) label backgroundColor:(UIColor *) backgroundColor alpha:(CGFloat) alpha text:(NSString *)  text textColor:(UIColor *) textColor font:(UIFont *)  font
{
 
    label.backgroundColor=backgroundColor;
    label.alpha=alpha;
    label.text=text;
    label.textColor=textColor;
    label.font=font;
    [self.view addSubview:label];
}

-(void) scrollViewDidScroll:(UIScrollView *)scrollView
{
    int currentPostion=scrollView.contentOffset.y;
    
    if (currentPostion>0) {
        
        
        self.title=@"gilr";
        self.navigationController.navigationBar.barTintColor = HEADVC;
        self.navigationController.navigationBar.alpha=0.9;

        
    }else{
        
        self.title=@"";
        self.navigationController.navigationBar.alpha=1.0;
    }
}

-(void)Back:(UIButton *)ttt{
    
    [self.navigationController popToRootViewControllerAnimated:YES];
}

-(void)souSuo:(UIButton *)sou{
    
    NSLog(@"ggggggggg");
    
}

-(void) buttonAction:(UIButton *) btn
{
    SupeiViewController  *sup=[[SupeiViewController alloc]init];
    [self.navigationController pushViewController:sup animated:YES];
}

-(void) buttonClick:(UIButton *) btn
{
   
}

-(void) btnAction:(UIButton *) btn
{
    
}

-(void) btnClick:(UIButton *) btn
{
   
}

@end
